package com.z.platform.controller.persistence.orm;

import com.z.platform.controller.persistence.orm.metadataModel.Entity;

import java.util.List;
import java.util.Map;

/**
 * @author haonan.zhang
 */
public interface Dao {

    /**
     * insert
     * @param entity
     * @return
     */
    int insert(Entity entity) ;

    /**
     * update
     * @param entity
     * @return
     */
    int updateById(Entity entity);

    /**
     * delete
     * @param entity
     * @return
     */
    int delete(Entity entity);

    /**
     * select
     * @param sql
     * @param params
     * @return
     */
    List<Map<String, Object>> select(String sql,Object ... params);

    /**
     * 开启事务
     */
     void startTransaction();

    /**
     * 关闭事务
     */
    void commitTransaction();

    /**
     * 回滚事务
     */
    void rollbackTransaction();
}
